package cn.itcast.dao.impl;


import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import cn.itcast.dao.TextBookDao;
import cn.itcast.mapper.TextBookMapper;
import cn.itcast.util.MybatisUtil;
import cn.itcast.vo.TextBook;

public class TextBookDaoImpl implements TextBookDao {
	private SqlSessionFactory sqlSessionFactory;

	public TextBookDaoImpl() {
	sqlSessionFactory=MybatisUtil.getSqlSessionFactory();
		
	}

	@Override
	public List<TextBook> getAllTextBook() {
		List<TextBook> list = null;
		SqlSession sqlSession = sqlSessionFactory.openSession();
		TextBookMapper textBookMapper=sqlSession.getMapper(TextBookMapper.class);
		
		list=textBookMapper.getAllTextBook();
		
		sqlSession.close();
		return list;
	}

	

}
